package com.xyb.utils;

import org.springframework.stereotype.Component;

import java.util.regex.Pattern;

@Component
public class CheckUtils {
    private static final String IPHONE_PATTERN = "^[1](([3-9][\\d])|([4][5,6,7,8,9])|([6][5,6])|([7][3,4,5,6,7,8])|([9][8,9]))[\\d]{8}$";


    /**
     * 校验手机号是否正确
     * @param iphoneNo
     * @return
     */
    public static boolean checkIphoneNo(String iphoneNo){
        Pattern pattern = Pattern.compile(IPHONE_PATTERN);
        if(pattern.matcher(iphoneNo).matches()){
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        boolean b = checkIphoneNo("15251922665");
        System.out.println("b = " + b);
    }
}